 /**
 * Description: excal
 * @author:jacky
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2019-03-18   jacky       1.0.0     Initial
 */
package com.metro.demo.excal.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.demo.excal.mapper.IExcalTestMapper;
import com.metro.demo.excal.service.inf.IExcalTestService;
import com.metro.demo.excal.beans.vo.ExcalTest;

 /**
 * excal<br>
 *
 * @author:jacky
 * @since:1.0.0
 * @version [1.0.0, 2019-03-18]
 */
@Service("excaltestService")
public class ExcalTestService extends BaseServiceSupport<ExcalTest> implements IExcalTestService{
    //excalMapper
    @Autowired
    private IExcalTestMapper excaltestMapper;

    @Override
    public IMapper getMapper() {
        return excaltestMapper;
    }

    @Override
    public IResult save(ExcalTest entity) {
        try {
            excaltestMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增excal失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(ExcalTest entity) {
        try {
            excaltestMapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改excal失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            excaltestMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            excaltestMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }
}